package com.luom.fsp.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.luom.fsp.model.dto.productReview.ProductReviewQueryRequest;
import com.luom.fsp.model.entity.ProductReview;
import com.luom.fsp.model.vo.ProductReviewVO;

import javax.servlet.http.HttpServletRequest;

/**
 * 商品评论服务
 *
*/
public interface ProductReviewService extends IService<ProductReview> {

    /**
     * 校验数据
     *
     * @param productReview
     * @param add 对创建的数据进行校验
     */
    void validProductReview(ProductReview productReview, boolean add);

    /**
     * 获取查询条件
     *
     * @param productReviewQueryRequest
     * @return
     */
    QueryWrapper<ProductReview> getQueryWrapper(ProductReviewQueryRequest productReviewQueryRequest);
    
    /**
     * 获取商品评论封装
     *
     * @param productReview
     * @param request
     * @return
     */
    ProductReviewVO getProductReviewVO(ProductReview productReview, HttpServletRequest request);

    /**
     * 分页获取商品评论封装
     *
     * @param productReviewPage
     * @param request
     * @return
     */
    Page<ProductReviewVO> getProductReviewVOPage(Page<ProductReview> productReviewPage, HttpServletRequest request);

    /**
     * 添加商品评论
     *
     * @param productReview
     * @param request
     * @return
     */
    long addProductReview(ProductReview productReview, HttpServletRequest request);
}
